////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    FameAndFortuneGuts.h                                         //
//  Developer:   Gilbert Araya                                                //
//  Create date: 09/10/2007                                                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called FameAndFortune.                      //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2007 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#if !defined(__FAMEANDFORTUNEGUTS_H__)
#define __FAMEANDFORTUNEGUTS_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "slotguts.h"

class FameAndFortuneGuts : public SlotGuts
{
public:
	FameAndFortuneGuts();

	virtual ~FameAndFortuneGuts();

private:
	// Shared enums between client and server
	#include "FameAndFortuneCommon.h"

	// Helpful lookup arrays.

	static SpinResult m_aLineWinSpinResults[][6];

	static SpinResult m_aScatterWinSpinResults[6]; //For the Normal Game
	static SpinResult m_aScatterFreeSpinResults[6]; //For the Free Game

	// Inline functions to use with the arrays that also do
	// bounds checking.

	static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}
	
	static SpinResult lookupScatterWinSpinResult( uint8 nCount, uint8 nModeId )
	{
		
		if ( nCount < 6 )
		{
			if ( nModeId == MODE_NORMAL )
			{
				return m_aScatterWinSpinResults[ nCount ]; //Use the normal spin scatter array
			}
			else
			{
				return m_aScatterFreeSpinResults[ nCount ]; //Use the Free Spin Scatter array 
			}
		}

		ASSERT( false );
		return EVT_INVALID;
	}
	
	// Helper functions for classifyStops.
	SpinResult getLineWinResultWithPossibleSubstitution(
		uint8* stops, uint8 testIcon, bool& bSubstitution ) const;

	// Helper functions for classifyScatters.
	void tryForJackpot( SlotSpin* spin );

	SpinResult getScatterWinResult( SlotSpin* spin, int32& nNumScatterIcons, int32& nScatterPositions ) const;
	
	void addScatterWin( SlotSpin* spin, SpinResult srScatterResult, int32 nScatterPositions );

	void addFeatureTrigger( SlotSpin* spin, int32& nNumScatterIcons, int32 nFeatureScatterPositions );

	//Gets the current spin number during the free game mode
	uint8 getCurrentFreeSpin(); 
	
	//Sets the current free spin number during the free game mode
	void setCurrentFreeSpin( uint8 nFreeSpin ); 

	//Gets the amount of Free Games won
	uint8 getFreeGamesWon();

	//Sets the amount of Free Games won
	void setFreeGamesWon( uint8 nNumOfFreeGames );

	//Gets the current 2X Free Spins remaining.
	int32 get2XFreeSpinsRemaining();

    //Sets the current 2X Free Spins remaining.
	void set2XFreeSpins( int32 n2XFreeSpins );

	// Increment the amout of 2X Free spins remaining in the specified amount.
	void increment2XFreeSpins(int32 n2XFreeSpins);

	// Decreases the amout of 2X Free spins remaining by 1.
	void decrease2XFreeSpins();

	//Gets the current 3X Free Spins remaining.
	int32 get3XFreeSpinsRemaining(); 

	//Sets the current 3X Free Spins remaining.
	void set3XFreeSpins( int32 n3XFreeSpins );

	// Increment the amout of 3X Free spins remaining in the specified amount.
	void increment3XFreeSpins(int32 n3XFreeSpins);

	// Decreases the amout of 3X Free spins remaining by 1.
	void decrease3XFreeSpins();

public:
	virtual void classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnresult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin *spin );

    virtual bool8 isValidGuts();

    virtual void getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );

protected:
	virtual void Debug_SetLoserStops( uint8* pStops );

};


#endif // !defined(__FAMEANDFORTUNEGUTS_H__)
